package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.BehaviorTypeService;
import com.wicket.okrframework.biz.service.dto.req.AddBehaviorTypeReqDto;
import com.wicket.okrframework.biz.service.dto.req.QueryBehaviorTypeDetailReqDto;
import com.wicket.okrframework.biz.service.dto.req.QueryBehaviorTypeListReqDto;
import com.wicket.okrframework.biz.service.dto.req.UpdateBehaviorTypeReqDto;
import com.wicket.okrframework.biz.service.dto.res.AddBehaviorTypeRespDto;
import com.wicket.okrframework.biz.service.dto.res.QueryBehaviorTypeDetailRespDto;
import com.wicket.okrframework.biz.service.dto.res.QueryBehaviorTypeListRespDto;
import com.wicket.okrframework.biz.service.dto.res.UpdateBehaviorTypeRespDto;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wicket.okrframework.biz.service.dto.res.QueryBehaviorTypeMenuListBorderRespDto;
import com.wicket.okrframework.biz.service.dto.req.QueryBehaviorTypeMenuListBorderReqDto;
import com.wicket.okrframework.biz.service.dto.res.BatchQueryBehaviorTypeBorderRespDto;
import com.wicket.okrframework.biz.service.dto.req.BatchQueryBehaviorTypeBorderReqDto;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/behaviorType/")
public class BehaviorTypeController {

    @Autowired
    BehaviorTypeService behaviorTypeService;

    /**
   * D1-1新增行为类型
   */
    @PostMapping("addBehaviorType")
    public OkrResult<AddBehaviorTypeRespDto> addBehaviorType(@RequestBody @Validated AddBehaviorTypeReqDto reqDTO){
    return OkrResult.success(behaviorTypeService.addBehaviorType(reqDTO));
    }

    /**
   * D1-1查询行为类型列表
   */
    @PostMapping("queryBehaviorTypeList")
    public OkrResult<QueryBehaviorTypeListRespDto> queryBehaviorTypeList(@RequestBody @Validated QueryBehaviorTypeListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryBehaviorTypeListRespDto retData = behaviorTypeService.queryBehaviorTypeList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1查询行为类型详情
   */
    @PostMapping("queryBehaviorTypeDetail")
    public OkrResult<QueryBehaviorTypeDetailRespDto> queryBehaviorTypeDetail(@RequestBody @Validated QueryBehaviorTypeDetailReqDto reqDTO){
    return OkrResult.success(behaviorTypeService.queryBehaviorTypeDetail(reqDTO));
    }

    /**
   * D1-1修改行为类型
   */
    @PostMapping("updateBehaviorType")
    public OkrResult<UpdateBehaviorTypeRespDto> updateBehaviorType(@RequestBody @Validated UpdateBehaviorTypeReqDto reqDTO){
    return OkrResult.success(behaviorTypeService.updateBehaviorType(reqDTO));
    }
/**
   * D1-1查询行为类型菜单列表(边界)
   */
    @PostMapping("queryBehaviorTypeMenuListBorder")
    public OkrResult<QueryBehaviorTypeMenuListBorderRespDto> queryBehaviorTypeMenuListBorder(@RequestBody @Validated QueryBehaviorTypeMenuListBorderReqDto reqDTO){
    return OkrResult.success(behaviorTypeService.queryBehaviorTypeMenuListBorder(reqDTO));
    }
/**
   * D1-1批量查询行为类型(边界)
   */
    @PostMapping("batchQueryBehaviorTypeBorder")
    public OkrResult<BatchQueryBehaviorTypeBorderRespDto> batchQueryBehaviorTypeBorder(@RequestBody @Validated BatchQueryBehaviorTypeBorderReqDto reqDTO){
    return OkrResult.success(behaviorTypeService.batchQueryBehaviorTypeBorder(reqDTO));
    }
}
